package top.dotgo.model.shop.bean;

import cn.hutool.core.bean.BeanUtil;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import top.dotgo.model.IBaseBean;
import top.dotgo.model.shop.ShopCompanyEntity;
import top.dotgo.model.sys.bean.SysAccountBean;
import top.dotgo.model.validate.CreateGroup;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * 商户 额外公司信息(ShopCompany)对象bean
 *
 * @author jornl
 * @date 2020-04-15 10:21:18
 */
@Getter
@Setter
@Accessors(chain = true)
public class ShopCompanyBean extends ShopCompanyEntity implements IBaseBean<ShopCompanyEntity>, Serializable {

    /**
     * 客户公司名称
     */
    @NotEmpty(message = "请输入供应商名称", groups = CreateGroup.class)
    private String name;
    /**
     * 客户公司简称
     */
    @NotEmpty(message = "请输入供应商简称", groups = CreateGroup.class)
    private String simpleName;
    /**
     * 客户公司编码
     */
    @NotEmpty(message = "请输入供应商编码", groups = CreateGroup.class)
    private String code;
    /**
     * logo图片
     */
    @NotEmpty(message = "请上传供应商门面照", groups = CreateGroup.class)
    private String logoPic;
    /**
     * 商户地址
     */
    @NotEmpty(message = "请输入供应商地址", groups = CreateGroup.class)
    private String address;
    /**
     * 提现手续费率，百分数
     */
    @Digits(integer = 4, fraction = 2, message = "手续费率错误[<100，2位小数]")
    @Min(value = 0, message = "手续费率不能小于0")
    @Max(value = 50, message = "手续费率不能大于50")
    private Double cashRate;

    /**
     * 开户行
     */
    @NotEmpty(message = "开户行不能为空", groups = CreateGroup.class)
    private String bankName;

    /**
     * 开户行账号
     */
    @NotEmpty(message = "收款账户不能为空", groups = CreateGroup.class)
    private String bankCode;

    /**
     * 经度
     */
    @NotNull(message = "经纬度不能为空", groups = CreateGroup.class)
    private Double lon;

    /**
     * 纬度
     */
    @NotNull(message = "经纬度不能为空", groups = CreateGroup.class)
    private Double lat;


    /**
     * 0禁用，1启用
     */
    private Integer status = 1;

    /**
     * 管理员账号信息
     */
    @NotNull(message = "请添加管理员信息", groups = CreateGroup.class)
    private SysAccountBean adminAccount;

    public static ShopCompanyBean bean(ShopCompanyEntity entity) {
        ShopCompanyBean bean = new ShopCompanyBean();
        BeanUtil.copyProperties(entity, bean);
        return bean;
    }

    @Override
    public ShopCompanyEntity entity() {
        ShopCompanyEntity entity = new ShopCompanyEntity();
        BeanUtil.copyProperties(this, entity);
        return entity;
    }


}
